<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<ul id="city">

</ul>


<script type="text/javascript">
    var cityList = ["北京", "shanghai", "guangzhou"];
    for (var idx in cityList) {
        var text = cityList[idx];
        // 创建li标签
        var tag = document.createElement("li");
        tag.innerText = text;
        var parentTag = document.getElementById("city");
        parentTag.appendChild(tag);
    }
</script>
</body>
</html>